﻿Public Class SecurityControl

    Public Function GetLevel() As String
        Return Me.lblStatus.Text
    End Function

    Public Sub SetLevel(ByVal Score As Integer)

        Me.ImgLevel1.Visible = False
        Me.ImgLevel2.Visible = False
        Me.ImgLevel3.Visible = False
        Me.ImgLevel4.Visible = False
        Me.ImgLevel5.Visible = False
        Me.ImgLevel6.Visible = False

        If Score <= 0 Then
            Me.lblStatus.Text = "Poor"
            Me.lblStatus.ForeColor = Color.Red
            Me.ImgLevel1.Visible = True
            Exit Sub
        End If

        Select Case Score
            Case 1
                Me.lblStatus.Text = "Poor"
                Me.lblStatus.ForeColor = Color.Red
                Me.ImgLevel1.Visible = True
            Case 2
                Me.lblStatus.Text = "Poor"
                Me.lblStatus.ForeColor = Color.Orange
                Me.ImgLevel2.Visible = True
            Case 3
                Me.lblStatus.Text = "Medium"
                Me.lblStatus.ForeColor = Color.Orange
                Me.ImgLevel3.Visible = True

            Case 4
                Me.lblStatus.Text = "Medium"
                Me.lblStatus.ForeColor = Color.LightGreen
                Me.ImgLevel4.Visible = True

            Case 5
                Me.lblStatus.Text = "Medium"
                Me.lblStatus.ForeColor = Color.Green
                Me.ImgLevel5.Visible = True

            Case 6
                Me.lblStatus.Text = "Strong"
                Me.lblStatus.ForeColor = Color.Green
                Me.ImgLevel6.Visible = True
            Case Else
                Me.lblStatus.Text = "Strong"
                Me.lblStatus.ForeColor = Color.DarkGreen
                Me.ImgLevel6.Visible = True
        End Select
    End Sub

End Class
